﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
//
using System.IO;
using System.Threading;

namespace WinForm_Test
{
    public partial class Form1 : Form
    {
        private int a;
        public Form1()
        {
            InitializeComponent();

            //
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //frmAsynchronousDelegate f = new frmAsynchronousDelegate();
            //f._AsyDelegateTest = this.AsynchronousDelegate;
            //f.ShowDialog();
            //frmTimer f = new frmTimer();
            //f.ShowDialog();
            //frmDateTimeCalculate f = new frmDateTimeCalculate();
            //f.ShowDialog();
            string res;
            DataTable dt = null;
            frmWaitingBox f = new frmWaitingBox((obj, args) =>
                {
                    Thread.Sleep(5000);
                    string sql = "SELECT * FROM [test].[dbo].[studentInfo]";
                    SQLHelper sqlHelper = new SQLHelper();
                    dt = sqlHelper.ExecuteSqlStr(sql, out res);
                },5,  "请等待...", false, false);
            f.ShowDialog(this);
            res = f.Message;
            dataGridView1.DataSource = dt;
            if (!string.IsNullOrEmpty(res))
                MessageBox.Show(res);
        }
        //
        private void AsynchronousDelegate(string message)
        {
            Thread.Sleep(5000);
            MessageBox.Show(message);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
                      
        }

        
    }
}
